// pages/demo/demo.js
let City = require('../../utils/allcity.js');
var app = getApp();
Page({

  data: {
    city: City
  },

  bindtap(e) {
    var detail = {"longitude":app.globalData.address.longitude,
                  "latitude":app.globalData.address.latitude,
                    "otherlon":e.detail.lng,
                    "otherlat":e.detail.lat,
                  "country":"中国",
                  "province":"",
                  "city":""+e.detail.name,
                  "district":"",
                  "township":""
                };

    
    // console.log(JSON.stringify(e.detail)+"===="+JSON.stringify(app.globalData.address))
    app.globalData.address = detail;
    // console.log(JSON.stringify(e.detail)+"===="+JSON.stringify(app.globalData.address))
    wx.navigateBack();
  },
  input(e) {
    this.value = e.detail.value
  },
  searchMt() {
    // 当没有输入的时候，默认inputvalue 为 空字符串，因为组件 只能接受 string类型的 数据 
    if (!this.value) {
      this.value = '';
    }
    this.setData({
      value: this.value
    })
  }

})